
using Yoozoo.Gameplay.RTS.Proto;

namespace Yoozoo.Gameplay.RTS
{
    /// <summary>
    /// 用于当键值
    /// </summary>
    public struct Troop
    {
        public TargetCoordinateType Type { get; set; }
        public long Uid { get; set; }

        public Troop(long uid,TargetCoordinateType type)
        {
            Uid = uid;
            Type = type;
        }
        public Troop(long uid,com.youzu.warh.protocol.TargetCoordinateType type)
        {
            Uid = uid;
            Type = (TargetCoordinateType)type;
        }
        // 重写 GetHashCode 方法和 Equals 方法，用于判断两个部队是否相等
        public override int GetHashCode()
        {
            return Type.GetHashCode() ^ Uid.GetHashCode();
        }

        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
                return false;

            Troop other = (Troop) obj;
            return Type == other.Type && Uid == other.Uid;
        }
    }
}